package org.example.test;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
 * @Author : zhangbo
 * @data : 2024/12/17
 * @description :
 */
public class test2 {
    public static void main(String[] args) {
        String  json="{\n" +
                "    \"code\": 200,\n" +
                "    \"msg\": null,\n" +
                "    \"data\": {\n" +
                "        \"errcode\": 0,\n" +
                "        \"errmsg\": \"ok\",\n" +
                "        \"userid\": \"zhangsan\",\n" +
                "        \"inOutFlag\": \"\",\n" +
                "        \"fgscode\": \"10001\",\n" +
                "        \"fgsname\": \"分公司名\",\n" +
                "        \"zzjgcode\": \"1000001\",\n" +
                "        \"zzjgname\": \"中支机构名\",\n" +
                "        \"name\": \"张三\",\n" +
                "        \"department\": [\n" +
                "            1,\n" +
                "            2\n" +
                "        ],\n" +
                "        \"order\": [\n" +
                "            1,\n" +
                "            2\n" +
                "        ],\n" +
                "        \"position\": \"后台工程师\",\n" +
                "        \"mobile\": \"13800000000\",\n" +
                "        \"gender\": \"1\",\n" +
                "        \"email\": \"zhangsan@gzdev.com\",\n" +
                "        \"biz_mail\": \"zhangsan@qyycs2.wecom.work\",\n" +
                "        \"is_leader_in_dept\": [\n" +
                "            1,\n" +
                "            0\n" +
                "        ],\n" +
                "        \"direct_leader\": [\n" +
                "            \"lisi\"\n" +
                "        ],\n" +
                "        \"avatar\": \"http://wx.qlogo.cn/mmopen/ajNVdqHZLLA3WJ6DSZUfiakYe37PKnQhBIeOQBO4czqrnZDS79FH5Wm5m4X69TBicnHFlhiafvDwklOpZeXYQQ2icg/0\",\n" +
                "        \"thumb_avatar\": \"http://wx.qlogo.cn/mmopen/ajNVdqHZLLA3WJ6DSZUfiakYe37PKnQhBIeOQBO4czqrnZDS79FH5Wm5m4X69TBicnHFlhiafvDwklOpZeXYQQ2icg/100\",\n" +
                "        \"telephone\": \"020-123456\",\n" +
                "        \"alias\": \"jackzhang\",\n" +
                "        \"address\": \"广州市海珠区新港中路\",\n" +
                "        \"open_userid\": \"xxxxxx\",\n" +
                "        \"main_department\": 1,\n" +
                "        \"extattr\": {\n" +
                "            \"attrs\": [\n" +
                "                {\n" +
                "                    \"type\": 0,\n" +
                "                    \"name\": \"文本名称\",\n" +
                "                    \"text\": {\n" +
                "                        \"value\": \"文本\"\n" +
                "                    }\n" +
                "                },\n" +
                "                {\n" +
                "                    \"type\": 1,\n" +
                "                    \"name\": \"网页名称\",\n" +
                "                    \"web\": {\n" +
                "                        \"url\": \"http://www.test.com\",\n" +
                "                        \"title\": \"标题\"\n" +
                "                    }\n" +
                "                }\n" +
                "            ]\n" +
                "        },\n" +
                "        \"status\": 1,\n" +
                "        \"qr_code\": \"https://open.work.weixin.qq.com/wwopen/userQRCode?vcode=xxx\",\n" +
                "        \"external_position\": \"产品经理\",\n" +
                "        \"external_profile\": {\n" +
                "            \"external_corp_name\": \"企业简称\",\n" +
                "            \"wechat_channels\": {\n" +
                "                \"nickname\": \"视频号名称\",\n" +
                "                \"status\": 1\n" +
                "            },\n" +
                "            \"external_attr\": [\n" +
                "                {\n" +
                "                    \"type\": 0,\n" +
                "                    \"name\": \"文本名称\",\n" +
                "                    \"text\": {\n" +
                "                        \"value\": \"文本\"\n" +
                "                    }\n" +
                "                },\n" +
                "                {\n" +
                "                    \"type\": 1,\n" +
                "                    \"name\": \"网页名称\",\n" +
                "                    \"web\": {\n" +
                "                        \"url\": \"http://www.test.com\",\n" +
                "                        \"title\": \"标题\"\n" +
                "                    }\n" +
                "                },\n" +
                "                {\n" +
                "                    \"type\": 2,\n" +
                "                    \"name\": \"测试app\",\n" +
                "                    \"miniprogram\": {\n" +
                "                        \"appid\": \"wx8bd80126147dFAKE\",\n" +
                "                        \"pagepath\": \"/index\",\n" +
                "                        \"title\": \"my miniprogram\"\n" +
                "                    }\n" +
                "                }\n" +
                "            ]\n" +
                "        }\n" +
                "    }\n" +
                "}";

        // 解析 JSON 字符串为 JSONObject
        JSONObject jsonObject = JSON.parseObject(json);

        // 从 JSON 对象中提取 data 对象
        JSONObject dataObject = jsonObject.getJSONObject("data");

        // 从 data 对象中提取 qr_code 字段的值
        String qrCode = dataObject.getString("qr_code");

        // 打印 qr_code 的值
        System.out.println("QR Code: " + qrCode);

    }
}
